<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">
                    <table id="table"></table>
                </div>
            </div>
        </div>
    </div>
</div> 

<style>
.control-label {
    padding-top: 7px;
}
</style>

<script>
var columns = [{
    field: 'title',
    title: '代理信息'
}, {
    field: 'bank',
    title: '支付宝',
    formatter: function(value,item){ // 自定义方法
        return '姓名：'+item.info.name+"<br>账号："+item.info.account
    }, 
}, {
    field: 'credit',
    title: '提现金额'
}, {
    field: 'status',
    title: '提现状态',
    formatter: function(value,item){ // 自定义方法
        if(item.status == 1) return '<span class="badge bg-success">已发放</span>'
        else return '<span class="badge bg-primary">未发放</span>'
    }, 
}, {
    field: 'createtime',
    title: '提现时间'
}, {
    field: 'operate',
    title: '操作',
    formatter: function(value,item){ // 自定义方法
        if(item.status == 1) return '';
        let html = '';
        html += '<div class="btn-group">';
            html += '<a class="btn btn-xs btn-primary edit-btn" data-toggle="tooltip" title="发放">发放</a>';
        html += '</div>';
        return html;
    }, 
    events: {
        'click .edit-btn': function (event, value, row, index) {
            event.stopPropagation();
            $.confirm({
        		title:'提现发放',
        		content: '确定已经转账给代理了吗？',
                buttons:{
                	confirm:{ 
                		text:'确认',
                		btnClass: "btn-primary",
                		action: function(){
                			showLoading();
        	                $.ajax({
        	                	url:"/SPAdmin/with/agree",
        	                	type:'post',
        	                	dataType:'json',
        	                	data:{id:row.id},
        	                	success:function(res){
        	                		hideLoading();
        	                		if(res.code == 1){
        	                			$.notify('操作成功');
                                        $('#table').bootstrapTable('refresh')
        	                		}else $.notify(res.msg);
        	                	}
        	                });
        	            },
                	},
                	cancel:{text:'取消'}
                }
        	});
        },
    }
}];
$('#table').bootstrapTable({
    url: '/SPAdmin/with',
    dataType: 'json',
	method: 'post',
    pagination: true,//开启分页
    pageSize:15,
    pageNumber:1,
    sidePagination:'server',
    search: false, //开启刷选
    columns: columns,
    queryParams:function(params) {
        /******获取分页数据时，这里你可以带上你自定义的参数,bootstrap table会把这些参数合并到请求里******/
       return params;
	}
});
</script>
